<!DOCTYPE html>
<html lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>第 2 章 批量处理光合测定数据 | 使用 R 语言分析 LI-6400 和 LI-6800 光合仪的数据</title>
  <meta name="description" content="使用 R 语言分析 LI-6400XT 与 LI-6800 数据" />
  <meta name="generator" content="bookdown 0.24 and GitBook 2.6.7" />

  <meta property="og:title" content="第 2 章 批量处理光合测定数据 | 使用 R 语言分析 LI-6400 和 LI-6800 光合仪的数据" />
  <meta property="og:type" content="book" />
  
  <meta property="og:image" content="/images/coverpage.png" />
  <meta property="og:description" content="使用 R 语言分析 LI-6400XT 与 LI-6800 数据" />
  <meta name="github-repo" content="zhujiedong/photoanalysis" />

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="第 2 章 批量处理光合测定数据 | 使用 R 语言分析 LI-6400 和 LI-6800 光合仪的数据" />
  
  <meta name="twitter:description" content="使用 R 语言分析 LI-6400XT 与 LI-6800 数据" />
  <meta name="twitter:image" content="/images/coverpage.png" />

<meta name="author" content="祝介东    北京力高泰科技有限公司" />


<meta name="date" content="2021-11-12" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  
<link rel="prev" href="intro.html"/>
<link rel="next" href="response_fit.html"/>
<script src="libs/header-attrs-2.11/header-attrs.js"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />








<link href="libs/anchor-sections-1.0.1/anchor-sections.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.0.1/anchor-sections.js"></script>


<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
  { counter-reset: source-line 0; }
pre.numberSource code > span
  { position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
  { content: counter(source-line);
    position: relative; left: -1em; text-align: right; vertical-align: baseline;
    border: none; display: inline-block;
    -webkit-touch-callout: none; -webkit-user-select: none;
    -khtml-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
    padding: 0 4px; width: 4em;
    color: #aaaaaa;
  }
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
div.sourceCode
  {   }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>

<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
  clear: both;
}
.hanging div.csl-entry {
  margin-left:2em;
  text-indent:-2em;
}
div.csl-left-margin {
  min-width:2em;
  float:left;
}
div.csl-right-inline {
  margin-left:2em;
  padding-left:1em;
}
div.csl-indent {
  margin-left: 2em;
}
</style>

<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">R 软件与光合数据分析</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>欢迎</a></li>
<li class="chapter" data-level="" data-path="frontmatter.html"><a href="frontmatter.html"><i class="fa fa-check"></i>前言</a></li>
<li class="chapter" data-level="" data-path="copyright.html"><a href="copyright.html"><i class="fa fa-check"></i>版权</a></li>
<li class="chapter" data-level="1" data-path="intro.html"><a href="intro.html"><i class="fa fa-check"></i><b>1</b> R 软件与 Rstudio</a>
<ul>
<li class="chapter" data-level="1.1" data-path="intro.html"><a href="intro.html#rsoft"><i class="fa fa-check"></i><b>1.1</b> R 软件</a></li>
<li class="chapter" data-level="1.2" data-path="intro.html"><a href="intro.html#rstudiosoft"><i class="fa fa-check"></i><b>1.2</b> Rstudio</a></li>
</ul></li>
<li class="chapter" data-level="2" data-path="batch_question.html"><a href="batch_question.html"><i class="fa fa-check"></i><b>2</b> 批量处理光合测定数据</a>
<ul>
<li class="chapter" data-level="2.1" data-path="batch_question.html"><a href="batch_question.html#install_readphoto"><i class="fa fa-check"></i><b>2.1</b> 安装</a></li>
<li class="chapter" data-level="2.2" data-path="batch_question.html"><a href="batch_question.html#batch64"><i class="fa fa-check"></i><b>2.2</b> LI-6400 数据处理</a>
<ul>
<li class="chapter" data-level="2.2.1" data-path="batch_question.html"><a href="batch_question.html#li-6400-数据的整合6400combine"><i class="fa fa-check"></i><b>2.2.1</b> LI-6400 数据的整合{#6400combine}</a></li>
<li class="chapter" data-level="2.2.2" data-path="batch_question.html"><a href="batch_question.html#recompute6400"><i class="fa fa-check"></i><b>2.2.2</b> LI-6400 数据重计算</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="batch_question.html"><a href="batch_question.html#li-6800-数据的处理-6800data"><i class="fa fa-check"></i><b>2.3</b> LI-6800 数据的处理 {#6800data}</a>
<ul>
<li class="chapter" data-level="2.3.1" data-path="batch_question.html"><a href="batch_question.html#r-下-excel-格式读取的重计算-6800xlconnect"><i class="fa fa-check"></i><b>2.3.1</b> R 下 Excel 格式读取的重计算 {##6800xlconnect}</a></li>
<li class="chapter" data-level="2.3.2" data-path="batch_question.html"><a href="batch_question.html#python"><i class="fa fa-check"></i><b>2.3.2</b> 使用 Python 来处理</a></li>
<li class="chapter" data-level="2.3.3" data-path="batch_question.html"><a href="batch_question.html#python-r-batch"><i class="fa fa-check"></i><b>2.3.3</b> 批量处理 csv 文件</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="3" data-path="response_fit.html"><a href="response_fit.html"><i class="fa fa-check"></i><b>3</b> CO<sub>2</sub> 响应曲线的拟合</a>
<ul>
<li class="chapter" data-level="3.1" data-path="response_fit.html"><a href="response_fit.html#fvcb_mod"><i class="fa fa-check"></i><b>3.1</b> FvCB 模型</a></li>
<li class="chapter" data-level="3.2" data-path="response_fit.html"><a href="response_fit.html#co2_note"><i class="fa fa-check"></i><b>3.2</b> CO<sub>2</sub> 响应曲线测量的注意事项</a>
<ul>
<li class="chapter" data-level="3.2.1" data-path="response_fit.html"><a href="response_fit.html#model_3"><i class="fa fa-check"></i><b>3.2.1</b> 分段性</a></li>
<li class="chapter" data-level="3.2.2" data-path="response_fit.html"><a href="response_fit.html#note_detail"><i class="fa fa-check"></i><b>3.2.2</b> 测量注意事项</a></li>
</ul></li>
<li class="chapter" data-level="3.3" data-path="response_fit.html"><a href="response_fit.html#plantecophys"><i class="fa fa-check"></i><b>3.3</b> <code>plantecophys</code> 软件包</a></li>
<li class="chapter" data-level="3.4" data-path="response_fit.html"><a href="response_fit.html#fit6400"><i class="fa fa-check"></i><b>3.4</b> LI-6400XT CO<sub>2</sub> 响应曲线的拟合</a>
<ul>
<li class="chapter" data-level="3.4.1" data-path="response_fit.html"><a href="response_fit.html#fitaci_intro"><i class="fa fa-check"></i><b>3.4.1</b> fitaci 函数介绍</a></li>
</ul></li>
<li class="chapter" data-level="3.5" data-path="response_fit.html"><a href="response_fit.html#plantecophy_use"><i class="fa fa-check"></i><b>3.5</b> 使用 <code>plantecophys</code> 拟合 LI-6400XT CO<sub>2</sub> 响应曲线数据</a>
<ul>
<li class="chapter" data-level="3.5.1" data-path="response_fit.html"><a href="response_fit.html#data6400"><i class="fa fa-check"></i><b>3.5.1</b> 数据的前处理</a></li>
<li class="chapter" data-level="3.5.2" data-path="response_fit.html"><a href="response_fit.html#fitaci-p"><i class="fa fa-check"></i><b>3.5.2</b> 使用示例</a></li>
<li class="chapter" data-level="3.5.3" data-path="response_fit.html"><a href="response_fit.html#onpoint_fit"><i class="fa fa-check"></i><b>3.5.3</b> 使用 ‘onepoint’ 单独计算 V<sub>cmax</sub> 和 J<sub>max</sub></a></li>
<li class="chapter" data-level="3.5.4" data-path="response_fit.html"><a href="response_fit.html#multi_curve"><i class="fa fa-check"></i><b>3.5.4</b> 多条 CO<sub>2</sub> 响应曲线的拟合</a></li>
<li class="chapter" data-level="3.5.5" data-path="response_fit.html"><a href="response_fit.html#transition"><i class="fa fa-check"></i><b>3.5.5</b> <code>findCiTransition</code> 函数</a></li>
</ul></li>
<li class="chapter" data-level="3.6" data-path="response_fit.html"><a href="response_fit.html#c4"><i class="fa fa-check"></i><b>3.6</b> C4 植物光合</a>
<ul>
<li class="chapter" data-level="3.6.1" data-path="response_fit.html"><a href="response_fit.html#c4_sim"><i class="fa fa-check"></i><b>3.6.1</b> C4 植物光合速率的计算</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="4" data-path="stomotal_sim.html"><a href="stomotal_sim.html"><i class="fa fa-check"></i><b>4</b> 气孔导度模型的拟合</a>
<ul>
<li class="chapter" data-level="4.1" data-path="stomotal_sim.html"><a href="stomotal_sim.html#ballberry"><i class="fa fa-check"></i><b>4.1</b> BallBerry 模型</a></li>
<li class="chapter" data-level="4.2" data-path="stomotal_sim.html"><a href="stomotal_sim.html#bbleuning"><i class="fa fa-check"></i><b>4.2</b> BBLeuning 模型</a></li>
<li class="chapter" data-level="4.3" data-path="stomotal_sim.html"><a href="stomotal_sim.html#bboptifull"><i class="fa fa-check"></i><b>4.3</b> BBOptiFull 模型</a></li>
<li class="chapter" data-level="4.4" data-path="stomotal_sim.html"><a href="stomotal_sim.html#fitbb-p"><i class="fa fa-check"></i><b>4.4</b> <code>fitBB</code> 函数</a></li>
<li class="chapter" data-level="4.5" data-path="stomotal_sim.html"><a href="stomotal_sim.html#fitbbs"><i class="fa fa-check"></i><b>4.5</b> <code>fitBBs</code> 函数</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="stomotal_couple.html"><a href="stomotal_couple.html"><i class="fa fa-check"></i><b>5</b> 光合最优气孔导度耦合模型</a>
<ul>
<li class="chapter" data-level="5.1" data-path="stomotal_couple.html"><a href="stomotal_couple.html#farao"><i class="fa fa-check"></i><b>5.1</b> <code>FARAO</code> 函数</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="photo_stomo.html"><a href="photo_stomo.html"><i class="fa fa-check"></i><b>6</b> 光合气孔导度耦合模型</a>
<ul>
<li class="chapter" data-level="6.1" data-path="photo_stomo.html"><a href="photo_stomo.html#photosyn"><i class="fa fa-check"></i><b>6.1</b> <code>Photosyn</code> 函数</a>
<ul>
<li class="chapter" data-level="6.1.1" data-path="photo_stomo.html"><a href="photo_stomo.html#photo_exam"><i class="fa fa-check"></i><b>6.1.1</b> <code>Photosyn</code> 使用举例</a></li>
</ul></li>
<li class="chapter" data-level="6.2" data-path="photo_stomo.html"><a href="photo_stomo.html#photsyneb"><i class="fa fa-check"></i><b>6.2</b> <code>PhotosynEB</code> 函数</a></li>
<li class="chapter" data-level="6.3" data-path="photo_stomo.html"><a href="photo_stomo.html#photosyntuzet"><i class="fa fa-check"></i><b>6.3</b> <code>PhotosynTuzet</code> 函数</a>
<ul>
<li class="chapter" data-level="6.3.1" data-path="photo_stomo.html"><a href="photo_stomo.html#photosyntuzet_para"><i class="fa fa-check"></i><b>6.3.1</b> <code>PhotosynTuzet</code> 的参数</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="7" data-path="rhtovpd.html"><a href="rhtovpd.html"><i class="fa fa-check"></i><b>7</b> RHtoVPD 函数</a></li>
<li class="chapter" data-level="8" data-path="lrc_fit.html"><a href="lrc_fit.html"><i class="fa fa-check"></i><b>8</b> 光响应曲线的拟合</a>
<ul>
<li class="chapter" data-level="8.1" data-path="lrc_fit.html"><a href="lrc_fit.html#rec_mod"><i class="fa fa-check"></i><b>8.1</b> 直角双曲线模型</a>
<ul>
<li class="chapter" data-level="8.1.1" data-path="lrc_fit.html"><a href="lrc_fit.html#rec_fit"><i class="fa fa-check"></i><b>8.1.1</b> 直角双曲线模型的实现</a></li>
</ul></li>
<li class="chapter" data-level="8.2" data-path="lrc_fit.html"><a href="lrc_fit.html#nonrec-mod"><i class="fa fa-check"></i><b>8.2</b> 非直角双曲线模型</a>
<ul>
<li class="chapter" data-level="8.2.1" data-path="lrc_fit.html"><a href="lrc_fit.html#nonrec_mode_exam"><i class="fa fa-check"></i><b>8.2.1</b> 非直角双曲线模型的实现</a></li>
</ul></li>
<li class="chapter" data-level="8.3" data-path="lrc_fit.html"><a href="lrc_fit.html#lrc_exp"><i class="fa fa-check"></i><b>8.3</b> 指数模型</a>
<ul>
<li class="chapter" data-level="8.3.1" data-path="lrc_fit.html"><a href="lrc_fit.html#lrc_exp_exam"><i class="fa fa-check"></i><b>8.3.1</b> 指数模型的实现</a></li>
</ul></li>
<li class="chapter" data-level="8.4" data-path="lrc_fit.html"><a href="lrc_fit.html#rev_rec"><i class="fa fa-check"></i><b>8.4</b> 直角双曲线的修正模型</a>
<ul>
<li class="chapter" data-level="8.4.1" data-path="lrc_fit.html"><a href="lrc_fit.html#rev_rec_exam"><i class="fa fa-check"></i><b>8.4.1</b> 直角双曲线修正模型的实现</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="9" data-path="start_con.html"><a href="start_con.html"><i class="fa fa-check"></i><b>9</b> 关于非线性拟合的初始值</a>
<ul>
<li class="chapter" data-level="9.1" data-path="start_con.html"><a href="start_con.html#nlslm"><i class="fa fa-check"></i><b>9.1</b> nlsLM 解决方案</a></li>
<li class="chapter" data-level="9.2" data-path="start_con.html"><a href="start_con.html#plot_comp"><i class="fa fa-check"></i><b>9.2</b> 作图比对法</a>
<ul>
<li class="chapter" data-level="9.2.1" data-path="start_con.html"><a href="start_con.html#plot_exam"><i class="fa fa-check"></i><b>9.2.1</b> 实现过程</a></li>
<li class="chapter" data-level="9.2.2" data-path="start_con.html"><a href="start_con.html#show_demo"><i class="fa fa-check"></i><b>9.2.2</b> 直观展示</a></li>
</ul></li>
<li class="chapter" data-level="9.3" data-path="start_con.html"><a href="start_con.html#mult_try"><i class="fa fa-check"></i><b>9.3</b> 自动多次尝试法</a></li>
<li class="chapter" data-level="9.4" data-path="start_con.html"><a href="start_con.html#sum_start"><i class="fa fa-check"></i><b>9.4</b> 小结</a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="anay_6800.html"><a href="anay_6800.html"><i class="fa fa-check"></i><b>10</b> LI-6800 的数据分析</a>
<ul>
<li class="chapter" data-level="10.1" data-path="anay_6800.html"><a href="anay_6800.html#data6800"><i class="fa fa-check"></i><b>10.1</b> 数据格式</a></li>
<li class="chapter" data-level="10.2" data-path="anay_6800.html"><a href="anay_6800.html#dif"><i class="fa fa-check"></i><b>10.2</b> LI-6800 与 LI-6400 使用时的差别</a></li>
<li class="chapter" data-level="10.3" data-path="anay_6800.html"><a href="anay_6800.html#notice"><i class="fa fa-check"></i><b>10.3</b> 光响应曲线注意事项</a></li>
<li class="chapter" data-level="10.4" data-path="anay_6800.html"><a href="anay_6800.html#other_light_response"><i class="fa fa-check"></i><b>10.4</b> 其他软件包的光响应曲线</a></li>
<li class="chapter" data-level="10.5" data-path="anay_6800.html"><a href="anay_6800.html#racir68"><i class="fa fa-check"></i><b>10.5</b> LI-6800 RACiR的测量与拟合</a></li>
<li class="chapter" data-level="10.6" data-path="anay_6800.html"><a href="anay_6800.html#racir-conifer"><i class="fa fa-check"></i><b>10.6</b> LI-6800 RACiR簇状叶的测量与拟合</a></li>
<li class="chapter" data-level="10.7" data-path="anay_6800.html"><a href="anay_6800.html#multi1"><i class="fa fa-check"></i><b>10.7</b> 多个速率的 RACiR 曲线研究</a>
<ul>
<li class="chapter" data-level="10.7.1" data-path="anay_6800.html"><a href="anay_6800.html#multi2"><i class="fa fa-check"></i><b>10.7.1</b> 光呼吸滞后模型</a></li>
<li class="chapter" data-level="10.7.2" data-path="anay_6800.html"><a href="anay_6800.html#code-photoresp"><i class="fa fa-check"></i><b>10.7.2</b> 光呼吸滞后性代码</a></li>
<li class="chapter" data-level="10.7.3" data-path="anay_6800.html"><a href="anay_6800.html#multi4"><i class="fa fa-check"></i><b>10.7.3</b> 数据的构造</a></li>
<li class="chapter" data-level="10.7.4" data-path="anay_6800.html"><a href="anay_6800.html#multi5"><i class="fa fa-check"></i><b>10.7.4</b> 光呼吸滞后性作图</a></li>
<li class="chapter" data-level="10.7.5" data-path="anay_6800.html"><a href="anay_6800.html#multi6"><i class="fa fa-check"></i><b>10.7.5</b> 补偿点计算</a></li>
<li class="chapter" data-level="10.7.6" data-path="anay_6800.html"><a href="anay_6800.html#multi7"><i class="fa fa-check"></i><b>10.7.6</b> 无光呼吸酶失活模块</a></li>
<li class="chapter" data-level="10.7.7" data-path="anay_6800.html"><a href="anay_6800.html#multi9"><i class="fa fa-check"></i><b>10.7.7</b> 酶失活作图</a></li>
<li class="chapter" data-level="10.7.8" data-path="anay_6800.html"><a href="anay_6800.html#multi10"><i class="fa fa-check"></i><b>10.7.8</b> 不同失活程度下补偿点计算</a></li>
</ul></li>
<li class="chapter" data-level="10.8" data-path="anay_6800.html"><a href="anay_6800.html#multi11"><i class="fa fa-check"></i><b>10.8</b> 时间延迟的扩散限制</a>
<ul>
<li class="chapter" data-level="10.8.1" data-path="anay_6800.html"><a href="anay_6800.html#multi12"><i class="fa fa-check"></i><b>10.8.1</b> 扩散限制滞后性</a></li>
</ul></li>
<li class="chapter" data-level="10.9" data-path="anay_6800.html"><a href="anay_6800.html#multi13"><i class="fa fa-check"></i><b>10.9</b> 扩散限制作图</a>
<ul>
<li class="chapter" data-level="10.9.1" data-path="anay_6800.html"><a href="anay_6800.html#multi14"><i class="fa fa-check"></i><b>10.9.1</b> 补偿点的计算</a></li>
<li class="chapter" data-level="10.9.2" data-path="anay_6800.html"><a href="anay_6800.html#multi15"><i class="fa fa-check"></i><b>10.9.2</b> 所有图形代码</a></li>
</ul></li>
<li class="chapter" data-level="10.10" data-path="anay_6800.html"><a href="anay_6800.html#fluro68"><i class="fa fa-check"></i><b>10.10</b> LI-6800 荧光数据分析</a>
<ul>
<li class="chapter" data-level="10.10.1" data-path="anay_6800.html"><a href="anay_6800.html#jiptest"><i class="fa fa-check"></i><b>10.10.1</b> jip test 的实现</a></li>
<li class="chapter" data-level="10.10.2" data-path="anay_6800.html"><a href="anay_6800.html#jiptest_pack"><i class="fa fa-check"></i><b>10.10.2</b> <code>jiptest</code> 软件包安装</a></li>
<li class="chapter" data-level="10.10.3" data-path="anay_6800.html"><a href="anay_6800.html#readfluor"><i class="fa fa-check"></i><b>10.10.3</b> <code>read_files</code> 及 <code>read_dcfiles</code> 函数</a></li>
<li class="chapter" data-level="10.10.4" data-path="anay_6800.html"><a href="anay_6800.html#testfluor"><i class="fa fa-check"></i><b>10.10.4</b> <code>jip_test</code> 及 <code>jip_dctest</code> 函数</a></li>
<li class="chapter" data-level="10.10.5" data-path="anay_6800.html"><a href="anay_6800.html#plotfluor"><i class="fa fa-check"></i><b>10.10.5</b> 图像查看函数</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="11" data-path="big-leaf.html"><a href="big-leaf.html"><i class="fa fa-check"></i><b>11</b> 大叶模型</a>
<ul>
<li class="chapter" data-level="11.1" data-path="big-leaf.html"><a href="big-leaf.html#leaf-scale-meas"><i class="fa fa-check"></i><b>11.1</b> 叶片尺度测量</a></li>
<li class="chapter" data-level="11.2" data-path="big-leaf.html"><a href="big-leaf.html#big-leaf-data"><i class="fa fa-check"></i><b>11.2</b> 数据的处理</a>
<ul>
<li class="chapter" data-level="11.2.1" data-path="big-leaf.html"><a href="big-leaf.html#single-data-big-leaf"><i class="fa fa-check"></i><b>11.2.1</b> 单个测量数据的处理</a></li>
<li class="chapter" data-level="11.2.2" data-path="big-leaf.html"><a href="big-leaf.html#big-leaf-data-MODEL"><i class="fa fa-check"></i><b>11.2.2</b> 大叶模型的数据处理</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="12" data-path="pca-anylysis.html"><a href="pca-anylysis.html"><i class="fa fa-check"></i><b>12</b> 大话 PCA</a>
<ul>
<li class="chapter" data-level="12.1" data-path="pca-anylysis.html"><a href="pca-anylysis.html#geom-pca"><i class="fa fa-check"></i><b>12.1</b> 几何解释</a></li>
<li class="chapter" data-level="12.2" data-path="pca-anylysis.html"><a href="pca-anylysis.html#alge-pca"><i class="fa fa-check"></i><b>12.2</b> 线性代数解释</a>
<ul>
<li class="chapter" data-level="12.2.1" data-path="pca-anylysis.html"><a href="pca-anylysis.html#egi-pca"><i class="fa fa-check"></i><b>12.2.1</b> 特征向量与特征值</a></li>
<li class="chapter" data-level="12.2.2" data-path="pca-anylysis.html"><a href="pca-anylysis.html#man_pca"><i class="fa fa-check"></i><b>12.2.2</b> 手动实现过程</a></li>
<li class="chapter" data-level="12.2.3" data-path="pca-anylysis.html"><a href="pca-anylysis.html#prcom"><i class="fa fa-check"></i><b>12.2.3</b> <code>prcomp</code> 的实现</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="13" data-path="sessioninfo.html"><a href="sessioninfo.html"><i class="fa fa-check"></i><b>13</b> 环境与配置</a></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>参考文献</a></li>
<li class="divider"></li>
<li><a href="https://bookdown.org" target="blank">由 bookdown 驱动</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">使用 R 语言分析 LI-6400 和 LI-6800 光合仪的数据</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="batch_question" class="section level1" number="2">
<h1><span class="header-section-number">第 2 章</span> 批量处理光合测定数据</h1>
<p>对于多数人来讲，一个季节用光合仪测量的数据文件至少是两位数的，处理起来非常不方便，针对这个问题，简单写了一个批量读取 LI-6400 和 LI-6800 原始数据的包(因为现有的容易实现的读取 excel 格式的包还不支持 6800 和 6400 这种形式的公式计算)<a href="references.html#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>，使用非常简单，同时也适合处理未关闭数据文件而导致的无法生成 excel 格式的数据时的问题。</p>
<div id="install_readphoto" class="section level2" number="2.1">
<h2><span class="header-section-number">2.1</span> 安装</h2>
<p>暂时只有我的 github repo 中的版本：</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="batch_question.html#cb1-1" aria-hidden="true" tabindex="-1"></a>devtools<span class="sc">::</span><span class="fu">install_github</span>(<span class="st">&quot;zhujiedong/readphoto&quot;</span>)</span></code></pre></div>
</div>
<div id="batch64" class="section level2" number="2.2">
<h2><span class="header-section-number">2.2</span> LI-6400 数据处理</h2>
<div id="li-6400-数据的整合6400combine" class="section level3" number="2.2.1">
<h3><span class="header-section-number">2.2.1</span> LI-6400 数据的整合{#6400combine}</h3>
<p>基本参数如下：</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb2-1"><a href="batch_question.html#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readphoto)</span>
<span id="cb2-2"><a href="batch_question.html#cb2-2" aria-hidden="true" tabindex="-1"></a>df64  <span class="ot">&lt;-</span> <span class="fu">read_bat_6400</span>(<span class="st">&quot;./data/6400&quot;</span>, <span class="at">header_line =</span> <span class="dv">17</span>, <span class="at">data_start =</span> <span class="dv">27</span>)</span></code></pre></div>
<p>数据输出如下所示(仅显示前8列数据)：</p>
<table>
<caption><span id="tab:unnamed-chunk-5">表 2.1: </span>LI-6400 批量整合数据</caption>
<thead>
<tr class="header">
<th align="left"></th>
<th align="left">files</th>
<th align="left">Obs</th>
<th align="left">HHMMSS</th>
<th align="right">FTime</th>
<th align="right">EBal.</th>
<th align="right">Photo</th>
<th align="right">Cond</th>
<th align="right">Ci</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">1</td>
<td align="left">aci</td>
<td align="left">1</td>
<td align="left">10:55:14</td>
<td align="right">483.0</td>
<td align="right">0</td>
<td align="right">6.990</td>
<td align="right">0.0831</td>
<td align="right">251.0</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">aci</td>
<td align="left">2</td>
<td align="left">10:57:35</td>
<td align="right">623.5</td>
<td align="right">0</td>
<td align="right">5.160</td>
<td align="right">0.0853</td>
<td align="right">192.0</td>
</tr>
<tr class="odd">
<td align="left">7</td>
<td align="left">aci</td>
<td align="left">3</td>
<td align="left">10:59:55</td>
<td align="right">763.5</td>
<td align="right">0</td>
<td align="right">3.140</td>
<td align="right">0.0881</td>
<td align="right">136.0</td>
</tr>
<tr class="even">
<td align="left">10</td>
<td align="left">aci</td>
<td align="left">4</td>
<td align="left">11:02:26</td>
<td align="right">914.5</td>
<td align="right">0</td>
<td align="right">0.910</td>
<td align="right">0.0927</td>
<td align="right">81.9</td>
</tr>
<tr class="odd">
<td align="left">13</td>
<td align="left">aci</td>
<td align="left">5</td>
<td align="left">11:04:46</td>
<td align="right">1055.0</td>
<td align="right">0</td>
<td align="right">-0.167</td>
<td align="right">0.0966</td>
<td align="right">52.7</td>
</tr>
<tr class="even">
<td align="left">16</td>
<td align="left">aci</td>
<td align="left">6</td>
<td align="left">11:07:23</td>
<td align="right">1211.5</td>
<td align="right">0</td>
<td align="right">5.240</td>
<td align="right">0.1010</td>
<td align="right">305.0</td>
</tr>
<tr class="odd">
<td align="left">19</td>
<td align="left">aci</td>
<td align="left">7</td>
<td align="left">11:09:43</td>
<td align="right">1352.0</td>
<td align="right">0</td>
<td align="right">6.610</td>
<td align="right">0.1040</td>
<td align="right">284.0</td>
</tr>
<tr class="even">
<td align="left">22</td>
<td align="left">aci</td>
<td align="left">8</td>
<td align="left">11:12:04</td>
<td align="right">1492.5</td>
<td align="right">0</td>
<td align="right">9.280</td>
<td align="right">0.1050</td>
<td align="right">438.0</td>
</tr>
<tr class="odd">
<td align="left">25</td>
<td align="left">aci</td>
<td align="left">9</td>
<td align="left">11:14:24</td>
<td align="right">1633.0</td>
<td align="right">0</td>
<td align="right">10.200</td>
<td align="right">0.1020</td>
<td align="right">616.0</td>
</tr>
<tr class="even">
<td align="left">28</td>
<td align="left">aci</td>
<td align="left">10</td>
<td align="left">11:16:44</td>
<td align="right">1772.5</td>
<td align="right">0</td>
<td align="right">10.500</td>
<td align="right">0.0943</td>
<td align="right">795.0</td>
</tr>
<tr class="odd">
<td align="left">31</td>
<td align="left">aci</td>
<td align="left">11</td>
<td align="left">11:19:49</td>
<td align="right">1958.0</td>
<td align="right">0</td>
<td align="right">10.700</td>
<td align="right">0.0853</td>
<td align="right">970.0</td>
</tr>
<tr class="even">
<td align="left">34</td>
<td align="left">aci</td>
<td align="left">12</td>
<td align="left">11:22:09</td>
<td align="right">2097.5</td>
<td align="right">0</td>
<td align="right">11.100</td>
<td align="right">0.0812</td>
<td align="right">1150.0</td>
</tr>
<tr class="odd">
<td align="left">41</td>
<td align="left">aq</td>
<td align="left">2</td>
<td align="left">10:12:52</td>
<td align="right">737.5</td>
<td align="right">0</td>
<td align="right">6.450</td>
<td align="right">0.0700</td>
<td align="right">239.0</td>
</tr>
<tr class="even">
<td align="left">44</td>
<td align="left">aq</td>
<td align="left">3</td>
<td align="left">10:15:12</td>
<td align="right">878.0</td>
<td align="right">0</td>
<td align="right">6.450</td>
<td align="right">0.0684</td>
<td align="right">235.0</td>
</tr>
<tr class="odd">
<td align="left">47</td>
<td align="left">aq</td>
<td align="left">4</td>
<td align="left">10:17:32</td>
<td align="right">1017.5</td>
<td align="right">0</td>
<td align="right">5.960</td>
<td align="right">0.0655</td>
<td align="right">241.0</td>
</tr>
</tbody>
</table>
<p>如果想另存为 csv 格式：</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="batch_question.html#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">write.csv</span>(df64, <span class="st">&quot;./combined.csv&quot;</span>)</span></code></pre></div>
<p>header_line 表示你数据表头所在行，data_start 表示你数据起始行，Obs = 1 时所在行，不含表头。这个也要确认好了，不同的测量不能放在一起（当然一般不会出现这种情况，同一台仪器，处理数据当然是希望 aci 和 aci 在一起，lrc 和 lrc 在一起，调查测量和调查测量在一起），不同的测量可能起始行不同，这样就会报错，特别需要注意的是，目前路径写法仅支持 “/” 分隔，不能使用 “\“ 作为分隔。例如在数据放在 D 盘的 6400 文件夹下，那么写法应为”d:/6400”, 不能为 <strong>“d:\6400”</strong>, 尽管后者对 R 是合法的，主要是因为我要区分你不同数据来源的文件是哪个，也即下文提到的 <code>df$files</code> 列。</p>
<p>其中，数据的来源在表格中第一列，叫做 files，是数据来源的文件名（即你起的名字）,例如本例中你看到的 aci 是我之前数据里面 aci 响应曲线的数据。</p>
<p>这些数据可以用于后文相关的分析中，尤其是像 <code>fitacis</code> 这样的函数，因为本质上他们都是符合 <code>tidyverse</code> 样式的数据。</p>
</div>
<div id="recompute6400" class="section level3" number="2.2.2">
<h3><span class="header-section-number">2.2.2</span> LI-6400 数据重计算</h3>
<p>参数的重计算函数为 <code>recomp_6400</code>, 其参数除了 <code>read_bat_6400</code> 所包含的参数外，还有叶面积 S, 以及叶片正反面的气孔比例，默认值分别为 6 和 0.5。</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb4-1"><a href="batch_question.html#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readphoto)</span>
<span id="cb4-2"><a href="batch_question.html#cb4-2" aria-hidden="true" tabindex="-1"></a>x1 <span class="ot">&lt;-</span> <span class="fu">read_bat_6400</span>(<span class="st">&quot;./data/6400&quot;</span>)</span>
<span id="cb4-3"><a href="batch_question.html#cb4-3" aria-hidden="true" tabindex="-1"></a>y1 <span class="ot">&lt;-</span> <span class="fu">recomp_6400</span>(<span class="st">&quot;./data/6400&quot;</span>, <span class="at">header_line =</span> <span class="dv">17</span>, <span class="at">data_start =</span> <span class="dv">27</span>, <span class="at">S =</span> <span class="dv">6</span>, <span class="at">K =</span> <span class="fl">0.5</span>)</span>
<span id="cb4-4"><a href="batch_question.html#cb4-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-5"><a href="batch_question.html#cb4-5" aria-hidden="true" tabindex="-1"></a>x1<span class="sc">$</span>Photo <span class="sc">-</span> y1<span class="sc">$</span>Photo</span></code></pre></div>
<pre><code>##  [1] -0.0008873753  0.0026900500 -0.0012036469  0.0003483414  0.0006122641
##  [6] -0.0113872639 -0.0020986076  0.0004962787  0.0188727482 -0.0294595908
## [11] -0.0436611445 -0.0339083408  0.0046772165  0.0036653298  0.0030397988
## [16] -0.0105901673  0.0040624956  0.0017317049 -0.0073252290  0.0054977377
## [21]  0.0039736503  0.0021704065  0.0046772165  0.0036653298  0.0030397988
## [26] -0.0105901673  0.0040624956  0.0017317049 -0.0073252290  0.0054977377
## [31]  0.0039736503  0.0021704065</code></pre>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="batch_question.html#cb6-1" aria-hidden="true" tabindex="-1"></a>x1<span class="sc">$</span>Trmmol <span class="sc">-</span> y1<span class="sc">$</span>Trmmol</span></code></pre></div>
<pre><code>##  [1] -2.998596e-04  1.407338e-04  3.189451e-05 -4.586467e-04 -3.836822e-04
##  [6]  5.402725e-04 -2.344852e-04 -7.684772e-05  5.979599e-04 -6.534341e-04
## [11] -6.779145e-04  2.469749e-04  3.812201e-04  2.313957e-04  3.508312e-04
## [16] -2.794358e-04 -5.406530e-04  5.230606e-04 -9.183370e-04  7.638850e-04
## [21] -2.578893e-04  2.203045e-04  3.812201e-04  2.313957e-04  3.508312e-04
## [26] -2.794358e-04 -5.406530e-04  5.230606e-04 -9.183370e-04  7.638850e-04
## [31] -2.578893e-04  2.203045e-04</code></pre>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="batch_question.html#cb8-1" aria-hidden="true" tabindex="-1"></a>x1<span class="sc">$</span>Cond <span class="sc">-</span> y1<span class="sc">$</span>Cond</span></code></pre></div>
<pre><code>##  [1] -1.974217e-04 -3.594216e-04 -3.779119e-04 -3.806675e-04 -3.201411e-04
##  [6] -1.483324e-04 -7.803345e-04 -2.671018e-04  1.028977e-04 -3.966192e-04
## [11] -3.190769e-04 -2.314266e-04 -2.746300e-04  1.094050e-05 -4.584791e-05
## [16] -1.084094e-04 -1.827768e-04 -1.344969e-04 -1.714096e-04 -8.180257e-05
## [21] -4.687906e-05 -1.000424e-04 -2.746300e-04  1.094050e-05 -4.584791e-05
## [26] -1.084094e-04 -1.827768e-04 -1.344969e-04 -1.714096e-04 -8.180257e-05
## [31] -4.687906e-05 -1.000424e-04</code></pre>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="batch_question.html#cb10-1" aria-hidden="true" tabindex="-1"></a>x1<span class="sc">$</span>Ci<span class="sc">-</span>y1<span class="sc">$</span>Ci</span></code></pre></div>
<pre><code>##  [1]  0.434643936 -0.297820404 -0.308200950 -0.007847373 -0.035490198
##  [6]  0.433706824 -0.416734067 -0.052089770  0.147655545 -0.315797917
## [11] -0.271335987 -0.228968795  0.356519198  0.311487646  0.052196075
## [16]  0.557128947  0.058563406  0.300198435  0.052607786  0.339000061
## [21] -0.252622980 -0.494554616  0.356519198  0.311487646  0.052196075
## [26]  0.557128947  0.058563406  0.300198435  0.052607786  0.339000061
## [31] -0.252622980 -0.494554616</code></pre>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="batch_question.html#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># half of original the area</span></span>
<span id="cb12-2"><a href="batch_question.html#cb12-2" aria-hidden="true" tabindex="-1"></a>y1 <span class="ot">&lt;-</span> <span class="fu">recomp_6400</span>(<span class="st">&quot;./data/6400&quot;</span>,  <span class="at">header_line =</span> <span class="dv">17</span>, <span class="at">data_start =</span> <span class="dv">27</span>, <span class="at">S =</span> <span class="dv">3</span>, <span class="at">K =</span> <span class="fl">0.5</span>)</span>
<span id="cb12-3"><a href="batch_question.html#cb12-3" aria-hidden="true" tabindex="-1"></a>y1<span class="sc">$</span>Photo<span class="sc">/</span>x1<span class="sc">$</span>Photo</span></code></pre></div>
<pre><code>##  [1] 2.000254 1.998957 2.000767 1.999234 2.007333 2.004346 2.000635 1.999893
##  [9] 1.996299 2.005611 2.008161 2.006110 1.998550 1.998863 1.998980 2.003671
## [17] 1.998391 1.999240 2.003866 1.995584 1.994199 2.010360 1.998550 1.998863
## [25] 1.998980 2.003671 1.998391 1.999240 2.003866 1.995584 1.994199 2.010360</code></pre>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="batch_question.html#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># test with random area less than six</span></span>
<span id="cb14-2"><a href="batch_question.html#cb14-2" aria-hidden="true" tabindex="-1"></a>area <span class="ot">&lt;-</span> <span class="dv">6</span> <span class="sc">-</span> <span class="fu">runif</span>(<span class="dv">32</span>, <span class="dv">1</span>, <span class="dv">3</span>)</span>
<span id="cb14-3"><a href="batch_question.html#cb14-3" aria-hidden="true" tabindex="-1"></a>y1 <span class="ot">&lt;-</span> <span class="fu">recomp_6400</span>(<span class="st">&quot;./data/6400&quot;</span>,  <span class="at">header_line =</span> <span class="dv">17</span>, <span class="at">data_start =</span> <span class="dv">27</span>, <span class="at">S =</span> area, <span class="at">K =</span> <span class="fl">0.5</span>)</span>
<span id="cb14-4"><a href="batch_question.html#cb14-4" aria-hidden="true" tabindex="-1"></a>y1<span class="sc">$</span>Photo<span class="sc">/</span>x1<span class="sc">$</span>Photo</span></code></pre></div>
<pre><code>##  [1] 1.890741 1.442401 1.922837 1.460636 1.263409 1.414596 1.757261 1.521830
##  [9] 1.291741 1.581095 1.452796 1.398753 1.884053 1.437109 1.228692 1.745059
## [17] 1.651811 1.603419 1.203926 1.310704 1.822923 1.804928 1.470240 1.768144
## [25] 1.900306 1.882726 1.906420 1.620766 1.682811 1.289687 1.447063 1.381292</code></pre>
<p>我们看到各个值之差非常小，因为我们使用的是相同的叶面积，理论上这两次读数的差异应为 0， 但在实际计算过程中，有小数点位数的影响，所以某些值不完全为 0，但该差值足够小。我们将所有的数据叶面积减半后，二者比值也约等于 2.</p>
</div>
</div>
<div id="li-6800-数据的处理-6800data" class="section level2" number="2.3">
<h2><span class="header-section-number">2.3</span> LI-6800 数据的处理 {#6800data}</h2>
<p>LI-6800 的数据我们可以直接处理 Excel 即可，读取我这里有两种方案，一种是 <code>R</code> 读取方案，一种是 <code>python</code> 读取方案，之所以这么复杂，是因为 LI-6800 的 Excel 格式较为复杂，不被常用的软件包所支持。我们分开来看两种方式：</p>
<div id="r-下-excel-格式读取的重计算-6800xlconnect" class="section level3" number="2.3.1">
<h3><span class="header-section-number">2.3.1</span> R 下 Excel 格式读取的重计算 {##6800xlconnect}</h3>
<p>偶然发现了 <code>XLConnect</code> 软件包的一个功能（以前知道这个软件包，但忽视了），那就是直接读取 LI-6800 Excel 格式的数据并重计算，我将其写成了函数，放在了我的 readphoto 软件包里，软件包的安装：</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="batch_question.html#cb16-1" aria-hidden="true" tabindex="-1"></a>remotes<span class="sc">::</span><span class="fu">install_github</span>(<span class="st">&quot;zhujiedong/readphoto&quot;</span>)</span></code></pre></div>
<p>当然，最近连我自己安装 github 的软件包都经常出问题，如果大家同样遇到问题，可以按照下面的方式安装：</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="batch_question.html#cb17-1" aria-hidden="true" tabindex="-1"></a>remotes<span class="sc">::</span><span class="fu">install_git</span>(<span class="st">&quot;https://gitee.com/zhu_jie_dong/readphoto&quot;</span>)</span></code></pre></div>
<p>其中：</p>
<ul>
<li><p>path 是 Excel 文件的路径；</p></li>
<li><p>start_row 是数据开始的行号；</p></li>
<li><p>S 为修改的叶面积，默认值为 6，如果叶面积无需更改，则使用默认的 NULL。如果使用 aperture 更改了面积，且叶片能够充满叶室，比方说是 2 <span class="math inline">\(cm^2\)</span>，该值必须输入一个长度和测量值数量完全一致的向量，例如有 3 个测量值，我们输入 S 的长度则为 3，例如，一共有三个测量值，只有第一个叶片没充满叶室，面积为 1.5，其他的为 2，则输入方式为 S = c(1.5, 2, 2)。</p></li>
</ul>
<p>我们直接使用下面的例子解释，导入的数据是 6 cm2 的默认面积：</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="batch_question.html#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(readphoto)</span>
<span id="cb18-2"><a href="batch_question.html#cb18-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb18-3"><a href="batch_question.html#cb18-3" aria-hidden="true" tabindex="-1"></a>df6 <span class="ot">&lt;-</span> <span class="fu">xlconnect_read</span>(<span class="st">&quot;./data/aci-xlc.xlsx&quot;</span>)</span>
<span id="cb18-4"><a href="batch_question.html#cb18-4" aria-hidden="true" tabindex="-1"></a>df6<span class="sc">$</span>A</span></code></pre></div>
<pre><code>##  [1] 24.7381184 18.1379358 10.8055345  3.0239340 -0.9144044 26.9519572
##  [7] 27.5088717 40.9101889 50.1393342 55.3865984 58.0662751 59.3556428</code></pre>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb20-1"><a href="batch_question.html#cb20-1" aria-hidden="true" tabindex="-1"></a>df3 <span class="ot">&lt;-</span> <span class="fu">xlconnect_read</span>(<span class="st">&quot;./data/aci-xlc.xlsx&quot;</span>, <span class="at">S =</span> <span class="fu">rep</span>(<span class="dv">3</span>, <span class="dv">12</span>))</span>
<span id="cb20-2"><a href="batch_question.html#cb20-2" aria-hidden="true" tabindex="-1"></a>df6<span class="sc">$</span>A<span class="sc">/</span>df3<span class="sc">$</span>A</span></code></pre></div>
<pre><code>##  [1] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5</code></pre>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb22-1"><a href="batch_question.html#cb22-1" aria-hidden="true" tabindex="-1"></a>df_random <span class="ot">&lt;-</span> <span class="fu">xlconnect_read</span>(<span class="st">&quot;./data/aci-xlc.xlsx&quot;</span>, <span class="at">S =</span> <span class="fu">rnorm</span>(<span class="dv">12</span>, <span class="dv">3</span>, <span class="fl">0.1</span>))</span>
<span id="cb22-2"><a href="batch_question.html#cb22-2" aria-hidden="true" tabindex="-1"></a>df6<span class="sc">$</span>A<span class="sc">/</span>df_random<span class="sc">$</span>A</span></code></pre></div>
<pre><code>##  [1] 0.4703268 0.5052066 0.5075169 0.5063254 0.5166228 0.4393696 0.4790926
##  [8] 0.5081278 0.5143876 0.4945837 0.5079758 0.4884164</code></pre>
<p>光合速率的倍数的变化在预期之内。</p>
</div>
<div id="python" class="section level3" number="2.3.2">
<h3><span class="header-section-number">2.3.2</span> 使用 Python 来处理</h3>
<p>本节内容与题目不符，不过大家也不用担心，我提供了一个图形界面来操作，可以将所有文件批量处理为 <code>csv</code> 格式。</p>
<p>python 方案见链接：<a href="https://github.com/zhujiedong/LI6800_excel2csv">github</a> 或 <a href="https://mp.weixin.qq.com/s?__biz=MzU4ODI3NjkzMg==&amp;mid=2247485489&amp;idx=2&amp;sn=9aed981d7624c8e289cb9173c269373a&amp;chksm=fdde7d9acaa9f48c3dc0d09324d0461b18b4edd4ff56207de54b5152cbfe4a97fdc482b31b82&amp;token=101697346&amp;lang=zh_CN#rd">微信</a></p>
</div>
<div id="python-r-batch" class="section level3" number="2.3.3">
<h3><span class="header-section-number">2.3.3</span> 批量处理 csv 文件</h3>
<p>如果还是比习惯用 <code>R</code>，我们来处理上面的 <code>csv</code> 文件即可。其实没什么特别的，就是需要批量导入后添加一个分组标签即可。以下为示例：</p>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb24-1"><a href="batch_question.html#cb24-1" aria-hidden="true" tabindex="-1"></a>files_csv <span class="ot">&lt;-</span> <span class="fu">list.files</span>(<span class="st">&quot;./data/csvdata&quot;</span>, <span class="at">full.names =</span> <span class="cn">TRUE</span>)</span>
<span id="cb24-2"><a href="batch_question.html#cb24-2" aria-hidden="true" tabindex="-1"></a>files_csv</span></code></pre></div>
<pre><code>## [1] &quot;./data/csvdata/racirtest1.csv&quot; &quot;./data/csvdata/rcirtest3.csv&quot;</code></pre>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb26-1"><a href="batch_question.html#cb26-1" aria-hidden="true" tabindex="-1"></a>add_remark <span class="ot">&lt;-</span> <span class="cf">function</span>(path){</span>
<span id="cb26-2"><a href="batch_question.html#cb26-2" aria-hidden="true" tabindex="-1"></a>  df <span class="ot">&lt;-</span> <span class="fu">read.csv</span>(path)</span>
<span id="cb26-3"><a href="batch_question.html#cb26-3" aria-hidden="true" tabindex="-1"></a>  df<span class="sc">$</span>remarks <span class="ot">&lt;-</span> <span class="fu">gsub</span>(<span class="st">&quot;.csv&quot;</span>, <span class="st">&quot;&quot;</span>, <span class="fu">basename</span>(path))</span>
<span id="cb26-4"><a href="batch_question.html#cb26-4" aria-hidden="true" tabindex="-1"></a>  <span class="fu">return</span>(df)</span>
<span id="cb26-5"><a href="batch_question.html#cb26-5" aria-hidden="true" tabindex="-1"></a>}</span>
<span id="cb26-6"><a href="batch_question.html#cb26-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-7"><a href="batch_question.html#cb26-7" aria-hidden="true" tabindex="-1"></a>list_csv <span class="ot">&lt;-</span> <span class="fu">lapply</span>(files_csv, add_remark)</span>
<span id="cb26-8"><a href="batch_question.html#cb26-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-9"><a href="batch_question.html#cb26-9" aria-hidden="true" tabindex="-1"></a>df_remark <span class="ot">&lt;-</span> <span class="fu">do.call</span>(rbind, list_csv)</span>
<span id="cb26-10"><a href="batch_question.html#cb26-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-11"><a href="batch_question.html#cb26-11" aria-hidden="true" tabindex="-1"></a>n <span class="ot">&lt;-</span> <span class="fu">ncol</span>(df_remark)</span>
<span id="cb26-12"><a href="batch_question.html#cb26-12" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(df_remark[,(n<span class="dv">-3</span>)<span class="sc">:</span>n])</span></code></pre></div>
<pre><code>##   H2O_r_sp    SS_s    SS_r    remarks
## 1       20 96.8399 99.4131 racirtest1
## 2       20 96.8405 99.4111 racirtest1
## 3       20 96.8409 99.4112 racirtest1
## 4       20 96.8411 99.4125 racirtest1
## 5       20 96.8413 99.4125 racirtest1
## 6       20 96.8411 99.4118 racirtest1</code></pre>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb28-1"><a href="batch_question.html#cb28-1" aria-hidden="true" tabindex="-1"></a><span class="fu">tail</span>(df_remark[,(n<span class="dv">-3</span>)<span class="sc">:</span>n])</span></code></pre></div>
<pre><code>##     H2O_r_sp    SS_s    SS_r   remarks
## 443       20 97.0539 99.6148 rcirtest3
## 444       20 97.0531 99.6159 rcirtest3
## 445       20 97.0533 99.6146 rcirtest3
## 446       20 97.0527 99.6133 rcirtest3
## 447       20 97.0534 99.6146 rcirtest3
## 448       20 97.0527 99.6146 rcirtest3</code></pre>
<p>到此为止已经整理为所谓的 <code>tidy data</code> 了，用 <code>tidyverse</code> 也好，用 <code>base</code> 语法也好，总之是比较容易处理的数据了，例如上面其实是 <code>RACiR</code> 数据了，有两个，那么当然可以使用 <code>plantecophys::fitacis</code> 来一条命令搞定所有数据的拟合了。</p>
<p>这里需要注意的是使用 <code>xlconnect_read</code> 也可以使用类似的操作，但我觉得不如这种方法省事，故而只列出来这一种，有需要的也可以按照类似方法处理即可。</p>

</div>
</div>
</div>
            </section>

          </div>
        </div>
      </div>
<a href="intro.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="response_fit.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
    </div>
  </div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": true,
"facebook": false,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"whatsapp": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/zhujiedong/photoanalysis/blob/master/01-2-batch-data.Rmd",
"text": "编辑"
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["bookdown.pdf"],
"search": {
"engine": "fuse",
"options": null
},
"toc": {
"collapse": "section"
}
});
});
</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "true";
    if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>
</body>

</html>
